home *** CD-ROM | disk | FTP | other *** search
/ Super Shareware Collection / Super Shareware Collection.iso / os_2 / pm22x333.zip / ARGC.ASM next >
Assembly Source File  |  1994-02-21  |  5KB  |  207 lines

  1.   CCHEKSWITCH           = 1
  2.   CCHEKSTR              = 1
  3.   CCHEKSSTR             = 1
  4.         .386p
  5. code32  segment para public use32
  6.         assume cs:code32, ds:code32, ss:code32
  7.  
  8. include pmode.inc
  9.  
  10. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  11. ; CODE
  12. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  13.  
  14. ;─────────────────────────────────────────────────────────────────────────────
  15. setandchek:                             ; Set up ES, EDI, ECX and chek length
  16.         mov bx,_selzero
  17.         mov es,bx
  18.         mov edi,_pspa
  19.         add edi,81h
  20.         movzx ecx,byte ptr es:[edi-1]
  21.         cmp cl,ah
  22.         jb setandchekf
  23.         ret
  24. setandchekf:                            ;  command line too short
  25.         add esp,4
  26.         pop es
  27.         popad
  28.         stc
  29.         ret
  30.  
  31. ;─────────────────────────────────────────────────────────────────────────────
  32. findswitch:                             ; Find switch AL on command line
  33.         mov ah,al
  34.         mov ebx,edi
  35.         mov ebp,ecx
  36. findswitchl1:
  37.         mov al,'/'
  38.         repnz scasb
  39.         jecxz findswitch2
  40.         mov al,ah
  41.         dec ecx
  42.         scasb
  43.         jne findswitchl1
  44.         ret
  45. findswitch2:
  46.         mov edi,ebx
  47.         mov ecx,ebp
  48. findswitchl2:
  49.         mov al,'-'
  50.         repnz scasb
  51.         jecxz setandchekf
  52.         mov al,ah
  53.         dec ecx
  54.         scasb
  55.         jne findswitchl2
  56.         ret
  57.  
  58. ifdef   CCHEKSWITCH
  59. public  _cchekswitchnc, _cchekswitch
  60. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  61. ; Chek if switch AL entered on command line
  62. ; In:
  63. ;   AL - switch
  64. ; Out:
  65. ;   CF=1 - switch does not exist
  66. ;   CF=0 - switch exists on command line
  67. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  68. _cchekswitchnc:
  69.         cmp al,'A'
  70.         jb short _cchekswitch
  71.         cmp al,'z'
  72.         ja short _cchekswitch
  73.         cmp al,'a'
  74.         jae short cchekswitchncf0
  75.         cmp al,'Z'
  76.         ja short _cchekswitch
  77. cchekswitchncf0:
  78.         push ax
  79.         and al,0dfh
  80.         call _cchekswitch
  81.         pop ax
  82.         jnc _ret
  83.         push ax
  84.         or al,20h
  85.         call _cchekswitch
  86.         pop ax
  87.         ret
  88. _cchekswitch:
  89.         pushad
  90.         push es
  91.         mov ah,3
  92.         call setandchek
  93.         call findswitch
  94.         pop es
  95.         popad
  96.         clc
  97.         ret
  98. endif
  99.  
  100. ifdef   CCHEKSTR
  101. public  _cchekstr
  102. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  103. ; Get string number AL
  104. ; In:
  105. ;   AL - string number
  106. ;   EDX -> buffer for string
  107. ; Out:
  108. ;   CF=1 - string not found
  109. ;   CF=0 - string found
  110. ;     EDX - ASCIIZ string
  111. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  112. _cchekstr:
  113.         pushad
  114.         push es
  115.         mov ah,2
  116.         call setandchek
  117.         inc al
  118.         mov bl,al
  119. chekstrl1:
  120.         mov al,' '
  121.         repnz scasb
  122.         jecxz chekstrf
  123.         mov al,es:[edi]
  124.         cmp al,'-'
  125.         je chekstrl1
  126.         cmp al,'/'
  127.         je chekstrl1
  128.         dec bl
  129.         jnz chekstrl1
  130.         push ds
  131.         mov ax,es
  132.         mov bx,ds
  133.         mov es,bx
  134.         mov ds,ax
  135.         mov esi,edi
  136.         mov edi,edx
  137. chekstrl2:
  138.         lodsb
  139.         stosb
  140.         cmp al,' '
  141.         loopnz chekstrl2
  142.         jnz chekstrf1
  143.         dec edi
  144. chekstrf1:
  145.         xor al,al
  146.         stosb
  147.         pop ds
  148.         pop es
  149.         popad
  150.         clc
  151.         ret
  152. chekstrf:
  153.         pop es
  154.         popad
  155.         stc
  156.         ret
  157. endif
  158.  
  159. ifdef   CCHEKSSTR
  160. public  _ccheksstr
  161. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  162. ; Get string associated with switch AL
  163. ; In:
  164. ;   AL - switch
  165. ;   EDX -> buffer for string
  166. ; Out:
  167. ;   CF=1 - string not found
  168. ;   CF=0 - string found or switch does not have string
  169. ;     EDX - ASCIIZ string
  170. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  171. _ccheksstr:
  172.         pushad
  173.         push es
  174.         mov ah,4
  175.         call setandchek
  176.         call findswitch
  177.         jecxz chekstrf
  178.         cmp byte ptr es:[edi],' '
  179.         je chekstrf
  180.         push ds
  181.         mov ax,es
  182.         mov bx,ds
  183.         mov es,bx
  184.         mov ds,ax
  185.         mov esi,edi
  186.         mov edi,edx
  187. cheksstrl2:
  188.         lodsb
  189.         stosb
  190.         cmp al,' '
  191.         loopnz cheksstrl2
  192.         jnz cheksstrf1
  193.         dec edi
  194. cheksstrf1:
  195.         xor al,al
  196.         stosb
  197.         pop ds
  198.         pop es
  199.         popad
  200.         clc
  201.         ret
  202. endif
  203.  
  204. code32  ends
  205.         end
  206.  
  207.